/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ejb.article;

import enteties.article.Group1FacadeLocal;
import java.util.Collection;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import util.article.GroupDetails;

/**
 *
 * @author Joris
 */
@Stateless
public class GroupBean implements GroupBeanRemote {

    @EJB
    private Group1FacadeLocal groupFacade;
    
    @Override
    public Collection<GroupDetails> getAllRootGroups(){
        return groupFacade.getAllRootGroups();
    }
    
    @Override
    public void createGroup(GroupDetails gd){
       int id = groupFacade.create(gd);
       //groupFacade.addGroupToParent(gd.getParentGroup(), id);
    }
    
    @Override
    public void editGroup(GroupDetails gd){
        //groupFacade.removeGroupFromParent(gd.getParentGroup(), gd.getId());
        groupFacade.editGroup(gd);
        //groupFacade.addGroupToParent(gd.getParentGroup(), gd.getId());
    }
    
    @Override
    public void removeGroup(GroupDetails gd){
        //groupFacade.removeGroupFromParent(gd.getParentGroup(), gd.getId());
        groupFacade.deleteGroup(gd.getId());
    }

}
